function getjQueryRD(json) {
var numPosts = json.feed.openSearch$totalResults.$t;
var indexPosts = new Array();
    var img  = new Array();
    var maxEntries = 5;
for (var i = 0; i < numPosts; ++i) {
indexPosts[i] = i;
}
indexPosts.sort(function() {return 0.5 - Math.random()});
if (maxEntries > numPosts) {
maxEntries = numPosts;
}

var container = document.getElementById('jquery-rd-posts');
var ul = document.createElement('ul');
ul.className='kwicks horizontal';
for (i = 0; i < maxEntries; ++i) {
var entry = json.feed.entry[indexPosts[i]];

var s = entry.content.$t; var a=s.indexOf("<img"); var b=s.indexOf("src=\"",a); var c=s.indexOf("\"",b+5); var d=s.substr(b+5,c-b-5);

for (var j = 0; j < entry.link.length; ++j) {
if (entry.link[j].rel == 'alternate') {
var urlpost = entry.link[j].href;
break;
}
}

if ("thr$total" in entry) {var kcm=entry.thr$total.$t;}
else {var kcm="none";}

if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!=""))
{var imgurl = d;} 
else 
{ var imgurl="http://1.bp.blogspot.com/_u4gySN2ZgqE/SosvnavWq0I/AAAAAAAAArk/yL95WlyTqr0/s400/noimage.png";}

var li = document.createElement('li');
li.className='kwick_style';
if (i==0) { li.id = 'kwick_1'; } if (i==1) { li.id = 'kwick_2'; } if (i==2) { li.id = 'kwick_3'; } if (i==3) { li.id = 'kwick_4'; } if (i==4) { li.id = 'kwick_5'; }

var kwick_content ='<span class="fadeout"></span><span class="cmkwick">'+kcm+'</span><div class="excerpt"><strong>'+entry.title.$t+'</strong></div><a href="'+urlpost+'" rel="bookmark"><img src="'+imgurl+'" /></a>';

li.innerHTML = kwick_content; 

ul.appendChild(li);

}
container.appendChild(ul);
document.getElementById("jquery-rd-posts-loading").style.display = "none";
}

document.write("<script src=\""+home_page+"feeds/posts/default/-/"+kwlabel+"?max-results=9999&alt=json-in-script&callback=getjQueryRD\"><\/script>");
